<extend name="Public:innerbase"/>
<block name="css">
<link rel="stylesheet" href="{:STATICS}/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="{:STATICS}/kindeditor/plugins/code/prettify.css" />
<style class="text/css">
.tab-content{
	padding: 20px 10px 0;
}
.award-img{
	width:80px;height:80px;
}
.btn-upload input[type="file"]{
	position: absolute;
	opacity: 0;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	margin:0;
	padding:0;
	cursor: pointer;
	z-index: 10000;
}
.award-img-wrapper{position:relative;display: inline-block;margin-right:10px;}
.award-img-warpper img{}
.img-remove{position:absolute;right:0;top:0;width:30px;height:30px;color:rgb(155, 155, 155);cursor:pointer;background:url(/Public/Common/images/triangle-close.png) center no-repeat}
.img-remove:hover{color:red;}
</style>
</block>
<!--link rel="stylesheet" href="{:STATICS}/vote/style.css" /-->
<block name="js">
<include file="Public:upload" />
<script src="{:STATICS}/kindeditor/kindeditor.js" type="text/javascript"></script>
<script src="{:STATICS}/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
<script src="{:STATICS}/kindeditor/plugins/code/prettify.js" type="text/javascript"></script>
<script src="{:RES}/js/date/WdatePicker.js" type="text/javascript"></script>
<script src="{:STATICS}/vote/common.js" type="text/javascript"></script>
<script type="text/javascript" src="{:STATICS}/validation/js/jquery.validationEngine-zh_CN.js"></script>
<script type="text/javascript" src="{:STATICS}/js/holder.min.js"></script>
<script type="text/javascript" charset="utf-8" src="{:STATICS}/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="{:STATICS}/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="{:STATICS}/ueditor/lang/zh-cn/zh-cn.js"> </script>
<script type="text/javascript">
$(function(){
	$("#editForm").validationEngine("attach",{ 
		promptPosition:"centerRight",
		scroll:true,
		showOneMessage:true
	});
	var ue = UE.getEditor('UEContent');
});

var editor;
KindEditor.ready(function(K) {
	editor = K.create('#info', {
	resizeType : 1,
	allowPreviewEmoticons : false,
	allowImageUpload : true,
	uploadJson : '/index.php?m=User&c=Qiniu&a=kindEditorUpload',
	items : [
	'source','undo','plainpaste','wordpaste','clearhtml','quickformat','selectall','fullscreen','fontname', 'fontsize','subscript','superscript','indent','outdent','|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline','hr']
	});
});

$(function(){
	function check(el){
		if($(el).is(':checked')){
			$('#signEndTime').show();
		}
		else $('#signEndTime').hide();
	}
	check($('#onlineSign'));
	$('#onlineSign').change(function(){
		check(this);
	});
})
</script>

<script type="text/javascript">
	$("[data-toggle='upload-reward-img']>.upload-file").AjaxFileUpload({
		action: "{:U('Qiniu/upload')}",
		onComplete: function(filename, resp) {
			if(resp.error !=0){
				alert(resp.message);
			}
			else{
				var wrapper = $(sprintf(TPL,resp.url,targetName,resp.url));
				wrapper.appendTo('#'+target);
				wrapper.find('.img-remove').click(function(){
					$(this).parent().remove();
				});
			}
		}
	});
	
	$(function(){
		$('[data-toggle="upload-reward-img"]').click(function(){
			window.target = $(this).attr('data-target');
			window.targetName = $(this).attr('data-target-name');
		});
		$('.img-remove').click(function(){
			$(this).parent().remove();
		});
		$('.upload-music').click(function(){
			window.targetMusic = $(this).attr('data-target');
		});
	})
	
	$(".upload-music").AjaxFileUpload({
		action: "/User/Qiniu/Upload.html",
		onSubmit:function(){
			spark.showIndicator();
		},
		onComplete: function(filename, response) {
			spark.hideIndicator();
			if(response.error == 0){
				$('#'+targetMusic).val(response.url);
			}
			else{
				alert(response.message);
			}
		},
		onError: function(ret){
			spark.hideIndicator();
			alert(ret);
		}
	});
</script>
</block>
<block name="content">
<div class="container-fluid">
<div class="page-header">
	<a class="btn btn-sm btn-default" href="{:U('Bargain/index')}"><i class="fa fa-chevron-left"></i>&nbsp;返回</a>
</div>
<code><?php echo C('WAP_DOMAIN').'/wap/Bargain/index?token='.session('token').'&id='.$vo['id'];?></code>
<div style="margin-top:10px;">
	<form class="form-horizontal" method="post" action="">
		<if condition="$vo['id'] neq ''">
		  <input type="hidden" name="id" value="{$vo['id']}">
		</if>
		<div class="form-group">
			<label class="control-label col-xs-2">活动标题</label>
			<div class="col-md-4">
				<input type="text" name="title" value="{$vo.title}" class="form-control">
			</div>
		</div>
		<div class="form-group">
					<label class="control-label col-xs-2">背景音乐</label>
					<div class="col-md-5">
						<div class="input-group">
							<input type="text" class="form-control" id="music1" name="musicurl" value="{$vo.musicurl}" />
							<span class="input-group-btn btn-upload">
								<button class="btn btn-default" type="button"><i id="uploadIcon" class="glyphicon glyphicon-cloud-upload"></i></button>
								<input class="upload upload-music" type="file" name="file" data-target="music1" />
							</span>
						</div>
					</div>
		</div>
		
		<div class="form-group">
			<label class="control-label col-xs-2">背景图片</label>
			<div class="col-md-4">
				<input type="hidden" name="ppicurl" value="{$vo.ppicurl}" class="form-control" id="img4" style="display:inline-block;width:250px;" />
				<img id="img4Holder" style="width:216px;" class="img" src="{$vo.ppicurl}"/>
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('img4',720,400)">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('img4')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		
		
		<div class="form-group">
			<label class="control-label col-xs-2">顶部幻灯片1</label>
			<div class="col-md-4">
				<input type="hidden" name="banner" value="{$vo.banner}" class="form-control" id="img" style="display:inline-block;width:250px;" />
				<img id="imgHolder" style="width:216px;" class="img" src="{$vo.banner}"/>
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('img',720,400)">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('img')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">顶部幻灯片2</label>
			<div class="col-md-4">
				<img id="banner2Holder" style="width:216px;" class="img" src="{$vo.banner2}"/>
				<input type="hidden" name="banner2" value="{$vo.banner2}" class="form-control" id="banner2" />
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('banner2')">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('banner2')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		
		<div class="form-group">
			<label class="control-label col-xs-2">关注二维码</label>
			<div class="col-md-4">
				<input type="hidden" name="banner3" value="{$vo.banner3}" class="form-control" id="banner3" style="display:inline-block;width:250px;" />
				<img id="banner3Holder" style="width:216px;" class="img3" src="{$vo.banner3}"/>
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('banner3',720,400)">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('banner3')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">活动简介</label>
			<div class="col-md-4">
				<textarea class="form-control" id="info2" name="info" style="height: 120px;">{$vo.info}</textarea>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">活动时间：</label>
			<div class="col-md-6">
				<input style="display:inline-block;width:120px;" type="input" class="form-control" id="statdate" value="<if condition="$vo['statdate'] neq ''">{$vo.statdate|date="Y-m-d",###}</if>" data-toggle="datetime-picker" name="statdate">
				到
				<input style="display:inline-block;width:120px;" type="input" class="form-control" id="enddate" value="<if condition="$vo['enddate'] neq ''">{$vo.enddate|date="Y-m-d",###}</if>" name="enddate" data-toggle="datetime-picker">
			</div>
		</div>
	

		<div class="form-group">
			<label class="control-label col-xs-2">活动简介重命名：</label>
			<div class="col-md-4">
				<input type="text" name="rename1" value="{$vo.rename1}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">帮忙砍价重命名：</label>
			<div class="col-md-4">
				<input type="text" name="rename2" value="{$vo.rename2}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">我要砍价重命名：</label>
			<div class="col-md-4">
				<input type="text" name="rename3" value="{$vo.rename3}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">砍价说明重命名：</label>
			<div class="col-md-4">
				<input type="text" name="rename4" value="{$vo.rename4}" class="form-control" />
			</div>
		</div>
		
		<div class="form-group">
			<label class="control-label col-xs-2">分享标题：</label>
			<div class="col-md-4">
				<input type="text" name="share_title" value="{$vo.share_title}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">分享图片：</label>
			<div class="col-md-4">
				<img id="shareImgHolder" style="width:216px;" class="img" src="{$vo.share_img}"/>
				<input type="hidden" name="share_img" value="{$vo.share_img}" class="from-control" id="shareImg" />
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('shareImg',720,400)">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('shareImg')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">分享内容：</label>
			<div class="col-md-4">
				<input type="text" name="share_detail" value="{$vo.share_detail}" class="form-control" /><br />
				剩余金额：{last_mon}
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">无价格分享内容：</label>
			<div class="col-md-4">
				<input type="text" name="share_detail1" value="{$vo.share_detail1}" class="form-control" /><br />
			</div>
		</div>
		 <div class="form-group">
		 <label class="control-label col-xs-2">砍价说明：</label>
			<div class="col-sm-10">
				<textarea id="UEContent" style="height:420px;" name="content" >{$vo['content']|htmlspecialchars_decode}</textarea>
			</div>
		</div>		
		<div class="form-group">
			<label class="control-label col-xs-2">中奖标题：</label>
			<div class="col-md-4">
				<input type="text" name="htitle" value="{$vo.htitle}" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">中奖页主题</label>
			<div class="col-md-4">
				<input type="hidden" name="hbanner" value="{$vo.hbanner}" class="form-control" id="hbanner" style="display:inline-block;width:250px;" />
				<img id="hbannerHolder" style="width:216px;" class="img3" src="{$vo.hbanner}"/>
				<div class="btn-group" style="vertical-align:bottom;">
					<span class="btn btn-xs btn-primary" onclick="selectAsset('hbanner',720,400)">
						<span class="glyphicon glyphicon-cloud-upload"></span>选择
					</span>
					<span class="btn btn-primary btn-xs" onclick="previewImg('hbanner')">
						<span class="glyphicon glyphicon-picture"></span>预览
					</span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label col-xs-2">中奖简介</label>
			<div class="col-md-4">
				<textarea class="form-control" id="info2" name="hinfo" style="height: 120px;">{$vo.hinfo}</textarea>
			</div>
		</div>
		
		<div class="form-group">
			<div class="col-md-4 col-xs-offset-2">
				<button type="submit" name="button" class="btn btn-success">保存</button>
			</div>
		</div>
	</form>
</div>
</div>
</block>